package com.liang.subject.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ResultCodeEnum {

    SUCCESS(200,"成功"),
    FAIL(500,"失败");

    public int code;
    public String desc;

    public static ResultCodeEnum getByCode(int code) {
        for (ResultCodeEnum codeEnum : ResultCodeEnum.values()) {
            if (codeEnum.code == code) {
                return codeEnum;
            }
        }
        return null;
    }
}
